package com.ajisun.coding.ajisunmybatis.controller;

import com.ajisun.coding.ajisunmybatis.entity.SyncEmployee;
import com.ajisun.coding.ajisunmybatis.service.SyncEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Copyright (c) 2021. ajisun. All right reserved.
 * @ProjectName: ajisun-mybatis
 * @PackageName: com.ajisun.coding.ajisunmybatis.controller
 * @Date: 2021/10/26
 * @author: ajisun
 * @Email: ajisun
 */
@RestController
@RequestMapping("/user")
public class SyncEmployeeController {


    @Autowired
    private SyncEmployeeService syncEmployeeService;



    @GetMapping("/list")
    public ResponseEntity<List<SyncEmployee>> list(){

        return ResponseEntity.ok(syncEmployeeService.selectList());

    }


    @PostMapping("/batchInsert")
    public ResponseEntity<String> batchData(){

        syncEmployeeService.batchInsertData(System.currentTimeMillis());

        return ResponseEntity.ok("成功");

    }
}
